<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>响应式设计</title>
    <style>
      .container {
        display: flex;
        flex-direction: column;
        align-items: center;
      }
    </style>
  </head>
  <body>
    <h1>子元素的top/left/bottom/right是相对于直接非static定位的父元素的宽高</h1>
    <div
      style="
        position: relative;
        width: 200px;
        height: 200px;
        background-color: red;
      "
    >
      <div
        style="
          position: absolute;
          top: 10%;
          left: 10%;
          width: 50px;
          height: 50px;
          background-color: blue;
        "
      ></div>
    </div>
    <h1>
      子元素padding的百分比，相对于直接父元素的width，不论垂直方向还是水平方向
    </h1>
    <div
      style="
        position: relative;
        width: 100px;
        height: 100px;
        background-color: red;
      "
    >
      <div
        style="
          width: 50px;
          height: 50px;
          background-color: blue;
          padding: 10%;
          background-clip: content-box;
        "
      ></div>
    </div>
    <h1>
      子元素margin的百分比，相对于直接父元素的width，不论垂直方向还是水平方向
    </h1>
    <div
      style="
        position: relative;
        width: 100px;
        height: 100px;
        background-color: red;
        overflow: hidden;
      "
    >
      <div
        style="
          width: 50px;
          height: 50px;
          background-color: blue;
          margin: 10%;
          background-clip: content-box;
        "
      ></div>
    </div>
    <h1>border-radius的百分比是相对于自身的宽度</h1>
    <div
      style="
        position: relative;
        width: 50px;
        height: 50px;
        background-color: red;
        /* overflow: hidden; */
      "
    >
      <div
        style="
          width: 100px;
          height: 100px;
          background-color: blue;
          margin: 10%;
          background-clip: content-box;
          border-radius: 50%;
        "
      ></div>
    </div>
  </body>
</html>
